using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Condimar.Entities;

namespace Condimar.Repository.Mapping
{
    public class ClienteMap : EntityTypeConfiguration<Cliente>
    {
        public ClienteMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.RucDni)
                .HasMaxLength(11);

            this.Property(t => t.NombreRazonSocial)
                .HasMaxLength(100);

            this.Property(t => t.Direccion)
                .HasMaxLength(100);

            this.Property(t => t.Telefono)
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("Cliente");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.RucDni).HasColumnName("RucDni");
            this.Property(t => t.NombreRazonSocial).HasColumnName("NombreRazonSocial");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
            this.Property(t => t.Telefono).HasColumnName("Telefono");
        }
    }
}
